home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-05-29 | 18.3 KB | 782 lines | [SGPA/SCPG] |
-
- on AutoCreate
- global TheCurrentDialog, theDialog
- global Page_One, Page_Two -- Current page style selections.
- global FolderBase, userOldMeasurements
-
- set lockcursor to true
- set lockscreen to true
- set MouseCursor to busy
- put measurements into userOldMeasurements
- locatefonts
- put ":autocreate:newsletters:" into FolderBase
- open util script FolderBase&"_CTUtility"
- put 1 into Page_One
- put 1 into Page_Two
- put 501 into theCurrentDialog
- progressdialog open
-
- repeat forever
-
- do "put RunDialog" & TheCurrentDialog & "() into theResult"
-
- switch
- case theResult = "Next"
- put theCurrentDialog +1 into theCurrentDialog
- exit switch
- case theResult = "Prev" or theResult = "Previous"
- put theCurrentDialog -1 into theCurrentDialog
- exit switch
- case theResult = "Done"
- Exit repeat
- exit switch
- case theResult = "Cancel"
- get dialog(dispose, theDialog)
- exit AutoCreate
- exit switch
- end switch
-
- end repeat
-
-
- -- Build the Pages
- Set mousecursor to busy
-
- progressdialog show "Creating publication…"
- callscript "_CTsetpagesettings", "setpagesettings"
-
- set currentpage to 1
-
- -- Choose the Page Styles from the PICT ID's
- switch PAGE_ONE
- case 1011
- put 1 into PAGE_ONE
- exit switch
- case 1021
- put 2 into PAGE_ONE
- exit switch
- case 1031
- put 3 into PAGE_ONE
- exit switch
- case 1041
- put 4 into PAGE_ONE
- exit switch
- end switch
-
- switch PAGE_TWO
- case 1012
- put 1 into PAGE_TWO
- exit switch
- case 1022
- put 2 into PAGE_TWO
- exit switch
- case 1032
- put 3 into PAGE_TWO
- exit switch
- case 1042
- put 4 into PAGE_TWO
- exit switch
- end switch
-
-
- progressdialog show "Creating page 1…"
- Switch Page_One
- case 1
- callscript "_Classic Times 2 col 1 art.pg 1", "build_page_1_pg_1"
- exit switch
- case 2
- callscript "_Classic Times 2 col 2 art.pg 1", "build_page_2_pg_1"
- exit switch
- case 3
- callscript "_Classic Times 3 col 1 art.pg 1", "build_page_3_pg_1"
- exit switch
- case 4
- callscript "_Classic Times 3 col 2 art.pg 1", "build_page_4_pg_1"
- exit switch
- end switch
-
- set currentpage to 2
- progressdialog show "Creating page 2…"
- Switch Page_Two
- case 1
- callscript "_Classic Times 2 col 1 art.pg 2", "build_page_1_pg_2"
- exit switch
- case 2
- callscript "_Classic Times 2 col 2 art.pg 2", "build_page_2_pg_2"
- exit switch
- case 3
- callscript "_Classic Times 3 col 1 art.pg 2", "build_page_3_pg_2"
- exit switch
- case 4
- callscript "_Classic Times 3 col 2 art.pg 2", "build_page_4_pg_2"
- exit switch
- end switch
-
- if theResult = "Done" then
- get dialog(dispose, theDialog)
- end if
- set mouseCursor to "arrow"
- progressdialog close
- set saveGlobals to True
-
- end AutoCreate
-
- on cleanup
- Global TheCurrentDialog, FolderBase, TheStories, TotalStories, userOldMeasurements
-
- put 503 into TheCurrentDialog
- set ShuffleTextObjects to false
- put ":autocreate:newsletters:" into FolderBase
- open util script FolderBase&"_CTUtility"
- progressdialog open
- set lockscreen to true
- set lockcursor to true
- Set mousecursor to busy
- locatestories
-
-
- repeat forever
-
- do "put RunDialog" & TheCurrentDialog & "() into theResult"
-
- switch
- case theResult = "Next"
- put theCurrentDialog +1 into theCurrentDialog
- exit switch
- case theResult = "Prev" or theResult = "Previous"
- put theCurrentDialog -1 into theCurrentDialog
- exit switch
- case theResult = "Done"
- Exit repeat
- exit switch
- case theResult = "Cancel"
- get dialog(dispose, theDialog)
- publicationsetup columns 1
- set view to sizetofit
- set measurements to userOldMeasurements
- exit Cleanup
- exit switch
- end switch
-
- end repeat
-
- callscript "_CTCopyFitEveryStory", "CopyFitEveryStory"
-
- repeat with i = 1 to number of pages -- unlock all objects in doc so user has control
- set currentpage to i
- select all objects
- set locked to false
- end repeat
- set currentpage to 1
- select empty
-
- set view to sizetofit
- set displayGuides to false
- set measurements to userOldMeasurements
- end cleanup
-
-
-
- function RunDialog501
- -- Phase I, initial options.
- Global Page_One, Page_Two -- Scripted Pages to use.
- Global theDialog
-
- put 2 into Num_Columns -- Number of columns
- put 1 into Num_Stories -- Number of stories
-
- put dialog(preload, 501) into theDialog
-
- -- Disable buttons
- SetDialogItem 4,"Disabled" -- Place Graphics
- SetDialogItem 3,"Disabled" -- Previous Button
- SetDialogItem 6,"Disabled" -- Place Text
-
- -- Set default options
- SetDialogItem 7,"Set" -- "2 Columns"
- SetDialogItem 8,"Clear" -- "3 Columns"
-
- SetDialogItem 10,"Set" -- "1 Story"
- SetDialogItem 11,"Clear" -- "2 Stories"
-
- -- Define action procs
- SetDialogItem 9, "Box" -- "Number of Columns Box"
- SetDialogItem 12, "Box" -- "Number of Stories Box"
- SetDialogItem 18, "GrayBox" -- "Preview Box"
-
-
- put 1011 into PAGE_ONE
- put 1012 into PAGE_TWO
-
-
- repeat forever
-
- SetDialogItem 19,"Enabled","Picture", PAGE_ONE
- SetDialogItem 20,"Enabled","Picture", PAGE_TWO
-
- get dialog(display, theDialog)
-
- Switch it
- -- Done Button.
- case 1
- put "Done" into theResult
- exit repeat
- exit switch
-
- -- Cancel button
- case 2
- put "Cancel" into theResult
- exit repeat
- exit switch
-
- -- Help
- case 5
- helpdialog 501, "AutoCreate - Classic Newsletter Design Options"
- SetDialogItem 19,"Enabled","Picture", PAGE_ONE
- SetDialogItem 20,"Enabled","Picture", PAGE_TWO
- exit switch
-
- -- 2 Columns
- case 7
- put 2 into Num_Columns
- if Num_Stories = 1 then
- put 1011 into PAGE_ONE
- put 1012 into PAGE_TWO
- else
- put 1021 into PAGE_ONE
- put 1022 into PAGE_TWO
- end if
-
- exit switch
-
- -- 3 Columns
- case 8
- put 3 into Num_Columns
- if Num_Stories = 1 then
- put 1031 into PAGE_One
- put 1032 into PAGE_TWO
- else
- put 1041 into PAGE_ONE
- put 1042 into PAGE_TWO
- end if
- exit switch
-
- -- 1 Story
- case 10
- put 1 into Num_Stories
-
- if Num_Columns = 2 then
- put 1011 into PAGE_ONE
- put 1012 into PAGE_TWO
- else
- put 1031 into PAGE_ONE
- put 1032 into PAGE_TWO
- end if
- exit switch
-
- -- 2 Stories
- case 11
- put 2 into Num_Stories
- if Num_Columns = 2 then
- put 1021 into PAGE_ONE
- put 1022 into PAGE_TWO
- else
- put 1041 into PAGE_ONE
- put 1042 into PAGE_TWO
- end if
- exit switch
-
- end switch
-
- end repeat
-
- return theResult
- end RunDialog501
-
-
-
- function RunDialog503
- global TheStories, TotalStories, vTimes
- -- Phase III, Page Options.
- set displayguides to false
-
- put false into UpdateProxy
- put false into MakeJumpLines
- put false into IncludeTOC
- put "unknown" into TheResult
-
- set currentPage to 1
-
- progressdialog show "Preparing Options Dialog…"
- put dialog(preload, 503) into theDialog
- Set mousecursor to busy
-
- SetDialogItem 12, "Box" -- Action proc for Folio Options
- SetDialogItem 17, "Box" --Action proc for Document Options
- SetDialogItem 20, "GrayBox" -- Action proc for Preview Box
-
-
- set currentpage to 1
-
- -- -- Set status of Inlcude TOC button
- -- if TotalStories > 1 then
- -- put True into IncludeTOC
- -- SetDialogItem 7, "set", "enabled"
- -- else
- -- SetDialogItem 7, "clear", "disabled"
- -- put false into IncludeTOC
- -- end if
-
- set visible of Object "TOC" to IncludeTOC
- set visible of object "TOC Line" to IncludeTOC
-
-
-
- -- Set Volume name and date settings
- put date(Abbr) into THE_DATE -- Date = "Wed, Feb 5, 1992"
-
- SetDialogItem 8, "Set","Contents", "Classic Times" -- Publication Name.
- SetDialogItem 4, "Contents", "Volume 1, Number 1" -- Volume.
- SetDialogItem 5, "Contents", THE_DATE -- Date.
-
- -- Setup items on the page.
- put "Classic Times" into story "Publication Name"
- select all text in story "Publication Name"
- set styleRecomposition to false
- set RulerJustification to Center
- Set TextSize to 50
- set textfont to vTimes
- set textface to plain
- set textface to bold
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- put "Classic Times" into OldPubTitle
-
- put THE_DATE into story "Date"
- Select all text in Story "Date"
- set styleRecomposition to false
- set RulerJustification to right
- Set TextSize to 14
- set textfont to vTimes
- put THE_DATE into OldDate
- set styleRecomposition to true
-
- put "Volume 1, Number 1" into story "Volume"
- Select all Text in story "Volume"
- set styleRecomposition to false
- set TextSize to 14
- set textfont to vTimes
- put "Volume 1, number 1" into OldVolume
- set styleRecomposition to true
-
- put "On the Road Again" into Story "Issue Title"
- select all text in story "Issue Title"
- set styleRecomposition to false
- set RulerJustification to left
- set textsize to 36
- set textfont to vTimes
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- put "On the Road Again" into OldIssueTitle
-
-
- callscript "_CTSetStoryFonts", "SetStoryFonts"
-
- select empty
- SetDialogItem 22,"Proxy" -- Update Proxy.
-
- progressdialog hide
- repeat forever
- get dialog(display, theDialog)
-
- switch it
-
- case 1 -- Next Button
- put "Next" into theResult
- put true into UpdateProxy
- exit switch
- case 3 -- Help
- helpdialog 503, "AutoCreate - Other Newsletter Options"
- put true into UpdateProxy
- exit switch
- case 6
- put hilited(item6) into MakeJumpLines
- exit switch
-
- case 7
- put hilited(item7) into IncludeTOC
- set visible of Object "TOC" to IncludeTOC
- set visible of object "TOC Line" to IncludeTOC
- put true into UpdateProxy
- exit switch
-
- case 2 -- Update
- case 21
- case 20
- case 19 --User Force Update Preview Proxy
- put true into UpdateProxy
- exit switch
-
- end switch
-
- if UpdateProxy then
- -- Check if Publication Title has been modified
-
- if OldPubTitle ≠ ContentsOf(item8) then
- put ContentsOf(item8) into OldPubTitle
- select all text in story "Publication Name"
- set styleRecomposition to false
- put ContentsOf(item8) into story "Publication Name"
- set textfont to vTimes
- Set TextSize to 79
- set textface to plain
- set textface to bold
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- end if
-
- -- Check if Date has been modified
- if OldDate ≠ ContentsOf(item5) then
- put ContentsOf(item5) into OldDate
- select all text in story "Date"
- set styleRecomposition to false
- put ContentsOf(item5) into story "Date"
- Set TextSize to 14
- set textfont to vTimes
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- end if
-
- -- Check if Volume has been modified
- if OldVolume ≠ ContentsOf(item4) then
- put ContentsOf(item4) into OldVolume
- select all text in story "Volume"
- set styleRecomposition to false
- put ContentsOf(item4) into story "Volume"
- Set TextSize to 14
- set textfont to vTimes
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- end if
-
- -- Check if Issue Title has been modified
- if OldIssueTitle ≠ ContentsOf(item9) then
- put ContentsOf(item9) into OldIssueTitle
- select all text in story "Issue Title"
- set styleRecomposition to false
- put ContentsOf(item9) into story "Issue Title"
- Set TextSize to 36
- set textfont to vTimes
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- end if
-
- select empty
- SetDialogItem 22,"Proxy" -- Update Proxy.
- put false into UpdateProxy
- end if
-
- if TheResult = "Next" then
- If IncludeTOC then
- progressdialog show "Creating table of contents…"
- callscript "_CTCreateTOC", "CreateTOC"
- end if
- if MakeJumpLines then
- progressdialog show "Creating " & quote & "Continued from" & quote & " lines…"
- callscript "_CTCreateJumpLines", "CreateJumpLines"
- end if
- exit repeat
- end if
- end repeat
-
- get dialog(dispose, theDialog)
-
- return theResult
-
- End RunDialog503
-
-
-
- function RunDialog504
- global TheStories, TotalStories
- -- Headline Editor.
- set displayguides to false
- set shuffleTextObjects to false
-
- progressdialog show "Scanning for headlines…"
- put dialog(preload, 504) into theDialog
-
- -- Action proc for Headline Entry Box
- SetDialogItem 11, "Box"
-
- -- Action proc for Divider line.
- SetDialogItem 14, "Box"
- SetDialogItem 6, "Box"
-
- put "Unknown" into TheResult -- PPTalk can't evaluate uninitialized vars.
-
-
- -- Preset the Headlines
- repeat with x = 1 to TotalStories
- put item x of TheStories into TheTempStory
- set itemdel to "\"
- put item 3 of TheTempStory into ThePage -- Get Page.
- set itemdel to ","
- set currentpage to ThePage -- Go to that page.
- put empty into TempHold
- do "put paragraph 1 of story " & item 1 of storyloc of object (item x of TheStories)¬
- & " after TempHold"
- set the itemdel to numtochar(1)
- put tempHold into item x of TheCurrentTitles
- set itemdel to ","
- end repeat
-
- progressdialog hide
- if TotalStories = 0 then exit RunDialog504
- -- If only one story, then grey the next and prev buttons
- if TotalStories = 1 then
- SetDialogItem 4,"Disabled" -- Prev Headline.
- SetDialogItem 3,"Disabled" -- Next Headline.
- end if
-
- -- Tell user # of stories
- put "This publication has x headline(s). Personal Press has selected the" && ¬
- "first paragraph of the story for the headline. Make sure each headline is" &&¬
- "correct or type a new headline. " into TheInstructions
- put TotalStories into word 4 of TheInstructions
- SetDialogItem 9, "Text", TheInstructions
-
- put 1 into CurrentStoryNum -- Holds the current story number.
-
- -- Do every story in the pub.
- repeat forever
- put item CurrentStoryNum of TheStories into CurrentStoryName
-
- set itemdel to "\"
- set currentpage to item 3 of CurrentStoryName
- set itemdel to ","
-
- --Story preview box, Get the 1st 240 chars of the story.
- put empty into TheStory
- do "put trunctext(story "& ¬
- item 1 of storyloc of object CurrentStoryName & ¬
- ", 245) after TheStory"
- SetDialogItem 15, "Enabled","Text", TheStory
-
- -- Set name of story in the Headlines dialog box.
- SetDialogItem 16,"Contents", quote & ¬
- username of story (item 1 of storyloc of object CurrentStoryName) & quote
-
- -- Set the current headline.
- set itemdel to numtochar(1)
- put item CurrentStoryNum of TheCurrentTitles into TheHeadline
- set itemdel to ","
- SetDialogItem 10,"Set","Contents",TheHeadline
-
-
- -- Set Headline Preview Proxy
- select empty
- set the itemdel to "\"
- select objects where word 2 of item 2 of name of this object = "Title" and¬
- (word 2 of name of object CurrentStoryName = word 2 of name of this object)
- set the itemdel to ","
- put selectedobjects() into objs
- repeat with q = 1 to number(items in objs)
- put item q of objs into y
- -- Put the name of this object into the Title object.
- put TheHeadline into story item 1 of storyloc of object y
- select all text in story item 1 of storyloc of object y
- set styleRecomposition to false
- set textsize to 20
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
- put empty into isTitle
- end repeat -- Objects
-
-
- if (CurrentStoryNum = TotalStories) and (TotalStories > 1) then
- SetDialogItem 3,"Disabled" -- Next Headline.
- SetDialogItem 4,"Enabled" -- Prev Headline.
- else if (CurrentStoryNum = 1) and (TotalStories > 1) then
- SetDialogItem 3,"Enabled" -- Next Headline.
- SetDialogItem 4,"Disabled" -- Prev Headline.
- else if (CurrentStoryNum ≠ 1) and (TotalStories > 1) ¬
- and (CurrentStoryNum ≠ TotalStories) then
- SetDialogItem 3,"Enabled" -- Next Headline.
- SetDialogItem 4,"Enabled" -- Prev Headline.
- end if
-
- -- Handle the dialog.
- repeat forever
- get dialog(display, theDialog)
-
- switch it
- case 5 -- Help
- helpdialog 504, "AutoCreate - Headline Editor"
- SetDialogItem 9, "Text", TheInstructions
- SetDialogItem 15,"Text", TheStory
- exit switch
- case 19 -- Next Button
- put "Next" into theResult
- put ContentsOf(item10) into TheHeadline
- set itemdel to numtochar(1)
- put TheHeadline into item CurrentStoryNum of TheCurrentTitles
- set itemdel to ","
- exit repeat
- exit switch
-
- case 3 -- "Next Headline"
- put ContentsOf(item10) into TempHold
- set itemdel to numtochar(1)
- put TempHold into item CurrentStoryNum of TheCurrentTitles
- set itemdel to ","
- put 1+CurrentStoryNum into CurrentStoryNum
- if CurrentStoryNum > TotalStories then
- put TotalStories into CurrentStoryNum
- end if
- exit repeat
- exit switch
-
- case 4 -- "Prev Headline"
- put ContentsOf(item10) into tempHold
- set itemdel to numtochar(1)
- put TempHold into item CurrentStoryNum of TheCurrentTitles
- set itemdel to ","
- put CurrentStoryNum - 1 into CurrentStoryNum
- if CurrentStoryNum < 1 then put 1 into CurrentStoryNum
- exit repeat
- exit switch
-
-
- end switch
- end repeat -- Dialog Handler.
-
-
- if (TheResult = "Next") then
- -- Assign the titles.
- put CurrentPage into OldPage
- progressdialog show "Installing headlines…"
- repeat with x = 1 to TotalStories
- put item x of TheStories into TempStory -- Get the story.
- set itemdel to "\"
- put item 3 of TempStory into StoryCurrentPage -- Set the stories' page.
- set itemdel to ","
- put word 2 of item x of TheStories into TheStoryObject
-
- -- Look for title objects.
- repeat with p = 1 to number of pages -- go thru all pages.
- set currentpage to p
- select empty
- put word 2 of item x of TheStories into stynum
- set the itemdel to "\"
- select objects where word 2 of item 2 of name of this object = "Title" and¬
- stynum = word 2 of name of this object
- set the itemdel to ","
- put selectedobjects() into objs
- repeat with q = 1 to number(items in objs)
- put item q of objs into y
- put word 2 of name of object y into TheSearchObject
-
- set itemdel to numtochar(1)
- put item x of theCurrentTitles into TheChangedHeadLine
- set itemdel to ","
-
- put TheChangedHeadline into story item 1 of storyloc of object y
- select all text in story item 1 of storyloc of object y
- set styleRecomposition to false
- set textsize to 20
- set flexibleParaSpace to false
- Set flexibleLeading to false
- Set flexibleCharSize to true
- set styleRecomposition to true
- copyfit
-
- --Check the 1st ¶ to see if same as headline -- if Yes, Delete it.
- set currentpage to StoryCurrentPage
- do "put paragraph 1 of story " & ¬
- item 1 of storyloc of object (item x of TheStories)¬
- & " into TheCurrentHeadline"
- if TheCurrentHeadline = TheChangedHeadline then
- do "select text paragraph 1 of story " & ¬
- item 1 of storyloc of object (item x of TheStories)
- clear
- end if
- set currentpage to p
-
-
- end repeat -- Objects
- end repeat -- pages.
-
- end repeat -- Stories.
- set currentpage to OldPage
-
- if theResult = "Next" then exit repeat -- We're Done!
- end if
-
- end repeat -- Story Count.
-
- get dialog(dispose, theDialog)
-
- return theResult
-
- End RunDialog504
-
- function RunDialog505
- callscript "_CTMakePullQuotes", "MakePullQuotes"
- return "next"
- end RunDialog505
-
- function RunDialog506
- callscript "_CTMakeCaptions", "MakeCaptions"
- return "Done"
- end RunDialog506
-
- on callscript file, message
- global FolderBase
- open script FolderBase&file
- do message
- close script FolderBase&file
- end callscript
-
- on locatefonts
- global vHelvetica, vPalatino, vTimes, vNewYork, systemfonts
- put fontfamilies into systemfonts
- if systemfonts contains "New York" then put "New York" into vNewYork
- else put "Geneva" into vNewYork
- if systemfonts contains "helvetica" then put "helvetica" into vHelvetica
- else put "Geneva" into vHelvetica
- if systemfonts contains "Times" then put "Times" into vTimes
- else put vNewYork into vTimes
- if systemfonts contains "Palatino" then put "Palatino" into vPalatino
- else put vTimes into vPalatino
-
- end locatefonts
-
-
- on autoCreateHelp
- helpdialog 500, "Autocreate - Place text and graphics"
- set saveglobals to true
- end autoCreateHelp
-